-- Optimized performance to only update what is on screen. Plain graph is 3x faster.
-- Added the sound controls and colordepth controls.
-- Put range checking in preload cast and unload cast buttons.
-- New graphics
-- Changed how window resizes. Refers to window "memmon" and alerts if it does not exits.
-- memmon 2.11
-- made volumes adjust on mousedown (on the fly) rather than only on mouseUp
-- memmon 2.2
-- Added Tempo control. This controls how often memmon checks memory. Less checks = faster performance.
--In the works.
-- work out window resizing for windows.
-- Credits & Thanks.
-- Producer, Director, Author, Key Grip and Stunt Double - Alex Zavatone
-- Thanks to the rest of the Director Team for a killer product and good times over the last year. Also thanks to the QA team for input to make
-- the memmon more useful. Walker, Void and Lalit for the Mosaic Player. Walker for most frags on a P5 90 - Void for discovering the best
-- uses of the double barrel shotgun. doomheads.
On StartMovie
CheckForValidName
InitGlobals
InitConditions
InitPuppets
end
On CheckForValidName
set flag = 0
repeat with temp = 1 to count(the windowlist)
if the title of window temp = "memmon" then set flag = 1
end repeat
if the windowList = [] or not flag then alert "Please open the memmon with the title Memmon. Like this: From the message window, type - Open window "&Quote&"memmon"&Quote&". Open the main movie script for help. Thank you, the management."
end
on InitGlobals
global gBar, gOtherBar, gStartCast, gEndCast, gStartFrame, gEndFrame, gLevel, gTemp, gTempo
set gBar = 10
set gOtherBar = 26
set gStartCast = the value of field "CastStart"
set gEndCast = the value of field "CastEnd"
set gStartFrame = the value of field "FrameStart"
set gEndFrame = the value of field "FrameEnd"
set gTemp = 0
set gTempo = 5
set gLevel = 2
--gLevels = 1 = draw graph
-- = 2 = updatetext
-- = 3 = update filename
end
on InitConditions
set the floatprecision = 3
end
on InitPuppets
global gBar
puppetSprite gBar, true
puppetSprite gOtherBar, true
puppetSprite 29, true
puppetSprite 30, true
puppetSprite 31,true
puppetSprite 32, true
puppetSprite 33, true
puppetSprite 34, true
end
on Dome
-- inittime
global gLevel
UpdateGraph
if gLevel > 1 then
UpdateFields
end if
-- checktime
end
on UpdateGraph
global gBar, gOtherBar
if voidP(gBar) then startmovie
-- inittime
-- set firstbar, freebytes
set the height of sprite gBar = the height of cast "border" * ( the freeBytes * 1.0) / the memorySize + 1.0
-- set otherBar, the freeblock
set the height of sprite gOtherBar = the height of cast "border" * ( the freeBlock* 1.0) / the memorySize + 1.0
--checktime
end
on UpdateFields
put the memorysize &" = "& the memorySize/1024&"k" into field "memsize"
put the freebytes &" = "& the freebytes/1024&"k" into field "freebytes"
put the freeblock &" = "& the freeblock/1024&"k" into field "freeblock"
put the memorySize - the freebytes &" = "& (the memorySize - the freeBytes)/1024&"k" into field "MemUsed"
end
on GetValues
global gStartCast, gEndCast, gStartFrame, gEndFrame, gTemp
set gStartCast = the value of field "CastStart"
set gEndCast = the value of field "CastEnd"
set gStartFrame = the value of field "FrameStart"
set gEndFrame = the value of field "FrameEnd"
tell the stage to put the number of castMembers into gTemp
if gEndCast > gTemp then set gEndCast = gTemp
end
--- Time measurement
on StartTimer
return the ticks
end
on PutTime now
set delta = the ticks - now
put "ticks = " & delta into field "delta t"
put Return & "secs = "& delta/60.0 after field "delta t"
end
-- debug time calls
on InitTime
global gNow
set gnow = the ticks
end
on CheckTime
global gNow
put the ticks - gNow
end
--- Button control
on DoRight
set the castnum of sprite the clickon to the number of cast "Left"
set wind = window "memmon"
set leftSide = getat( the rect of wind, 1)
set topSide = getat( the rect of wind, 2)
set rightSide = getat( the rect of wind, 3)
set bottomSide = getat( the rect of wind, 4)
set the rect of wind = rect(leftSide, topSide, rightSide + 128, bottomSide)
end
on DoLeft
set the castnum of sprite the clickon to the number of cast "Right"
set wind = window "memmon"
set leftSide = getat( the rect of wind, 1)
set topSide = getat( the rect of wind, 2)
set rightSide = getat( the rect of wind, 3)
set bottomSide = getat( the rect of wind, 4)
set the rect of wind = rect(leftSide, topSide, rightSide - 128, bottomSide)
end
on DoUp arrow
if voidP(arrow) then
set the castnum of sprite the clickon to the number of cast "down"
else
set the castnum of sprite 29 to 0
updatestage
end if
set wind = window "memmon"
set leftSide = getat( the rect of wind, 1)
set topSide = getat( the rect of wind, 2)
set rightSide = getat( the rect of wind, 3)
set bottomSide = getat( the rect of wind, 4)
set the rect of wind = rect(leftSide, topSide, rightSide, bottomSide - 86)
end
on DoDown arrow
if voidP(arrow) then
set the castnum of sprite the clickon to the number of cast "up"
else
set the castnum of sprite 29 to the number of cast "up"
end if
set wind = window "memmon"
set leftSide = getat( the rect of wind, 1)
set topSide = getat( the rect of wind, 2)
set rightSide = getat( the rect of wind, 3)
set bottomSide = getat( the rect of wind, 4)
set the rect of wind = rect(leftSide, topSide, rightSide, bottomSide + 86)
end
--- get moviename
on GetMainMovieName
global gMovie
tell the stage to set gMovie = the movieName
put gMovie into field "Moviename"
end
---
on ResetTabButtons
set the backcolor of sprite 31 = 250
set the backcolor of sprite 32 = 245
set the backcolor of sprite 33 = 245
set the backcolor of sprite 34 = 245
end
---
On TurnOffDepthPuppets
repeat with temp = 13 to 17
puppetSprite temp, 0
end repeat
end
On TurnOffVolumePuppets
repeat with temp = 35 to 40
puppetsprite temp, 0
puppetsprite temp, 0
end repeat
end
on UpdateMeters
-- update main vol meter
set mainVolHeight = (64 - (9 * the soundLevel ))
set the height of sprite 35 = mainVolHeight
set the locV of sprite 38 = 69 + mainVolHeight - 3
-- update vol 1 meter
set mainVolHeight = (64 - (0.251 * the volume of sound 1 ))
set the height of sprite 36 = mainVolHeight
set the locV of sprite 39 = 69 + mainVolHeight - 3
-- update vol 2 meter
set mainVolHeight = (64 - (0.251 * the volume of sound 2 ))
set the height of sprite 37 = mainVolHeight
set the locV of sprite 40 = 69 + mainVolHeight - 3
end
on Memmon
-- We are not foolproof
go frame 1
set the rect of window "memmon" = the sourceRect of window "memmon"
open window "memmon"
end
on InitTempoIndicator
global gTempo
puppetSprite 22,0
puppetSprite 22,1
set the locV of sprite 22 = the bottom of sprite 21 - gTempo * 3 - 1